<?php
namespace lisPHP\DB;
/**
 * 数据工厂
 * author      : lis
 * creatTime   : 2015-12-29 15:03
 * email       : 407505297@qq.com
 * description :
 */
class Db{
    public static function factor($dbConfigKey='DB_CONFIG'){
        //根据参数选择加载不同的数据库配置
        $db_config = getConfig($dbConfigKey);
        $dbType = strtolower($db_config['DB_TYPE']);
        switch($dbType){
            case 'mysql':
                $className = 'Mysql';
                break;
            default:
                exit('Error：Database Type');
        }
        $className = 'lisPHP\DB\\'.$className;
        return new $className($dbConfigKey);
    }
}
?>